<?php

$obj=new mysql($config);
if(!empty($_POST)){
      if($_POST['password']!=$_POST['passwordtwo']){
         echo "<script>alert('密码不一致');history.go(-1);</script>";
      }
      
      unset($_POST['passwordtwo']);
      $_POST['createtime']=time();
      $_POST['password']=md5($_POST['password']);
      $_POST['ip']=$_SERVER['REMOTE_ADDR'];
      
      
      $row=$obj->insert($_POST,'user');
      $insert_id=$obj->getInsertid();
      if($row>0){
      	sendEmail($_POST['email'],$insert_id,1);
      }else{
      	echo "<script>alert('注册失败');history.go(-1);</script>";
      }
}

if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])){
      $email=$_GET['email'];
      $sql="select * from `user` where `email`='$email'";
      echo $obj->getOne($sql);
      die;


}







require_once VIEW_PATH.'home/layout.html';
